package pl.edu.pw.perg.compinfodb.command;

import org.springframework.richclient.application.ViewDescriptor;
import org.springframework.richclient.command.support.ApplicationWindowAwareCommand;

public class SwitchToViewCommand extends ApplicationWindowAwareCommand {

  private ViewDescriptor viewDescriptor;
  public ViewDescriptor getViewDescriptor () { return viewDescriptor; }
  public void setViewDescriptor (final ViewDescriptor viewDescriptor) { 
      this.viewDescriptor = viewDescriptor;
      setId(viewDescriptor.getId());
      setDefaultButton();
  }
  
  protected void doExecuteCommand () {
      getApplicationWindow().getPage().showView(getViewDescriptor());
  }
}